Skip to content

initial SOF hdac serials. - #47

Merged
lgirdwood merged 7 commits into
thesofproject:topic/hdacfrom
keyonjie:sof-hda
Jul 30, 2018
Merged

initial SOF hdac serials.#47
lgirdwood merged 7 commits into
thesofproject:topic/hdacfrom
keyonjie:sof-hda

Conversation

@keyonjie

Copy link
Copy Markdown

No description provided.

Comment thread sound/soc/intel/boards/Kconfig Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks odd. why is this needed in the boards Kconfig?
Looks further, this makes no sense, in the same patch you have

select SND_SOC_SOF_HDA if SND_SOC_SOF_HDA_COMMON

+config SND_SOC_SOF_HDA

  • tristate
  • depends on SND_SOC_SOF_HDA_COMMON

so you've expressed a dependency twice for no good reason

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

um, this do need rewrite, I will do that. But before that, can you explain to me that is selecting 2 machine driver(e.g. BXT_TDF8532_MACH and SKL_HDA_DSP_GENERIC_MACH) together is our intention?

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big series and we should probably try to think about the code structure to make it less invasive. See comments below

Comment thread sound/soc/sof/sof-priv.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really want hda_bus at the snd_sof_dev level? This is a bit Intel-centric, maybe it should be hidden in HDA specific structures, no?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

today I will work on this, Liam suggest me to unify it with sof_intel_hda_dev(delete sof_intel_hda_dev if possible), Mengdong give a good suggestion that using private struct for it then other arch(e.g. ARM, non-HDA stuff) can reuse it.

Comment thread sound/soc/sof/intel/hda-stream.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we needed different ring buffers for CORB and RIRB, similar to capture and playback?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are allocated together(4KB) and corb/rirb are initialized to use different regions( pls refer to snd_hdac_bus_init_cmd_io()):
bus->corb.addr = bus->rb.addr;
bus->rirb.addr = bus->rb.addr + 2048;

Comment thread sound/soc/sof/intel/hda.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to rename this Kconfig to CONFIG_SND_SOC_SOC_HDA_LINK ?
HDA can mean controller, bus or codec. Here you handle the two latter topics.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good suggestion, will change it.

Comment thread sound/soc/sof/intel/hda.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid copy/pastes from GPL comments

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove/rewrite them, thanks.

Comment thread sound/soc/sof/intel/hda.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that looks wrong. We get the PCM period updates from the existing SOF code, why do we need to do this based on link information?

Comment thread sound/soc/sof/intel/hda.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we have an .ops here and select which mode we want? It'd allow all the HDA link part to go in a different file. Ifdefs are hard to handle at some point, it's difficult to read.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, will change it, thanks.

Comment thread sound/soc/sof/intel/hda.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the defines are probably wrong, if IS_ENABLED(CONFIG_SND_SOC_HDAC_HDA) is false, the ext_ops is not initialized. Is this is intentional you've got to comment it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

um, this comes from cAVS, no chance to debug it yet, if soc_hdac_hda unselected, I think it may pass ext_ops with NULL and no ops(e.g. attach/detach) will be processed?

Comment thread sound/soc/sof/intel/hda.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the part below is super hard to review.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

um, Liam helps to refine and consolidate them in his consequent commit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Differentiation was moved to separate new functions to avoid lots of conditional compilation logic in a single function.

Comment thread sound/soc/intel/boards/bxt_tdf8532.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we don't make the same mistake as cAVS. the entire code for HDMI is common between platforms, so let's do it right from day 1, by adding the links from a common code instead of copy/pasting.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we have problem here. So our intention is to add skl_hda_be_dai_links[] from skl_hda_dsp_common.c together with broxton_tdf8532_dais[] at broxton_tdf8532_audio_probe()?

@keyonjie

Copy link
Copy Markdown
Author

updates on 0723:

  1. refine Kconfig.
  2. fix hdmi codec probing failed issue.

@keyonjie

Copy link
Copy Markdown
Author

@lgirdwood @mengdonglin @plbossart please be noticed that it is updated.

@keyonjie

Copy link
Copy Markdown
Author

@lgirdwood @mengdonglin @plbossart
new update today: we have finished to replace sof_intel_hda_stream with hdac_stream, and fix NULL pointer issue, now PCM created and playback works for I2S BE on gpmrb.

@keyonjie

Copy link
Copy Markdown
Author

update on 0725:
We use CONFIG_SND_SOC_SOF_HDA to enable HDA links on SOF, refine
SOF HDA code to split them and make both select/unselect the config
CONFIG_SND_SOC_SOF_HDA works.


#include <sound/hdaudio.h>

#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this implied by Kconfig option

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you meaning that IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) is true always?
the answer is no for that, it is tristate, we can choose them or not in menuconfig.

Comment thread sound/soc/sof/intel/hda-bus.c Outdated

#endif

static void sof_hda_reg_writel(u32 value, u32 __iomem *addr)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any need to wrap these ? cant the ops point to writew() etc directly ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just went through them again, no need to wrap them, let me change them, thanks.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, double checked this, we can't point to writew() etc directly, as they are actually inline functions and will be expanded(not functions then), so we still need to wrap them.

@@ -1,9 +1,9 @@
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change the license.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will modify.

Comment thread sound/soc/sof/intel/hda.c
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)

#if 0
static int sof_hda_acquire_irq(struct hda_bus *hbus, int do_disconnect)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is thsi MSI irq working ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSI doesn't work for HDA in my testing, so I set it to legacy mode temporary, will change it to MSI once it is verified works.

Comment thread sound/soc/sof/intel/hda.h Outdated
int irq;
};

#define SOF_STREAM_SD_OFFSET(s) (0x20 * ((s)->index) + SOF_HDA_ADSP_LOADER_BASE)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where does 0x20 come from ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should change it to an macro, it is size of all registers belong to a separated stream.

}
}


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need period_elapsed() ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, no, we do that in IPC interrupt handler.

Comment thread sound/soc/sof/intel/hda-stream.c Outdated
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev, 8,
&hdev->posbuffer);
/* TODO: check postion buffer update */
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev, 8 * num_total,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does 8 come from ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8 Bytes is the size of DMA posistion for each stream defined in HDA spec, let me change it to macro also.

Comment thread sound/soc/sof/intel/hda.c
* support msi multiple vectors
*/
// ret = pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_MSI);
/* todo: MSI mode doesn't work for HDMI yet, debug it later */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still true ? If so, temp workaround is to use LEGACY IRQ for HDAC mode (based on Kconfig) otherwise MSI.

Comment thread sound/soc/sof/intel/hda.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Differentiation was moved to separate new functions to avoid lots of conditional compilation logic in a single function.


config SND_SOC_SOF_HDA
tristate
tristate "SOF support for HDA Links(HDA/HDMI)"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this have a help section (check patch complains without one).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me add it.

keyonjie added 2 commits July 27, 2018 18:08
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
We need register/enable irq handler before init_caps, where we are doing
codec probing for HDMI/HDA, otherwise the probing may fail.

We also need to use PCI_IRQ_LEGACY mode at the moment, as PCI_IRQ_MSI
doesn't work for HDMI yet, may need more debug to fix it.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
@keyonjie
keyonjie force-pushed the sof-hda branch 2 times, most recently from f22e0d3 to 410c8ea Compare July 27, 2018 10:34
This patch doesn't replace struct sof_intel_hda_dev with hda_bus, but
embed hda_bus in sof_intel_hda_dev. It's becasue there are a few
memebers
of sof_intel_hda_dev are not in hda_bus.

Host streams are managed by hdac_bus's stream_list now.

Compiling okay. But not test yet. May have conflict with Keyon's PR
today.
I'll rebase and merge it to Keyon's PR later.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
In previous patch, hdac_bus is used to manage the host streams, but the
stream structure is still struct sof_intel_hda_stream.

This patch replaces struct sof_intel_hda_stream with hdac_ext_stream,
but the stream management is still using BSD implementation of SOF, not
the GPL implemenation of HDA core.

Please note that
- hdac_bus maintains a stream list of hdac_stream, which is embeded in
  struct hdac_ext_stream.
- pcm runtime's private data points to hdac_stream, not hdac_ext_stream.

Compiling okay. Not tested yet.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
keyonjie added 3 commits July 27, 2018 19:23
…issue.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
1. add hda-bus to handle hda bus initialization, for both with/without
HDA links support.
2. split hda-codec out from hda-common, and compile it when SOF_HDA is
selected.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
We uses CONFIG_SND_SOC_SOF_HDA to enable HDA links on SOF, here refine
SOF HDA code to split them and make both select/unselect the config
CONFIG_SND_SOC_SOF_HDA works.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
@keyonjie

Copy link
Copy Markdown
Author

all are addressed. @lgirdwood

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants